home *** CD-ROM | disk | FTP | other *** search
/ CD Actual Thematic 7: Programming / CDAT7.iso / Share / Codigo / hh / rsource.exe / Heretic Source / P_LOCAL.H < prev    next >
Encoding:
C/C++ Source or Header  |  1996-02-13  |  7.4 KB  |  263 lines

  1.  
  2. // P_local.h
  3.  
  4. #ifndef __P_LOCAL__
  5. #define __P_LOCAL__
  6.  
  7. #ifndef __R_LOCAL__
  8. #include "R_local.h"
  9. #endif
  10.  
  11. #define STARTREDPALS    1
  12. #define STARTBONUSPALS    9
  13. #define NUMREDPALS        8
  14. #define NUMBONUSPALS    4
  15.  
  16. #define FOOTCLIPSIZE    10*FRACUNIT
  17.  
  18. #define TOCENTER -8
  19. #define    FLOATSPEED (FRACUNIT*4)
  20.  
  21. #define    MAXHEALTH 100
  22. #define MAXCHICKENHEALTH 30
  23. #define    VIEWHEIGHT (41*FRACUNIT)
  24.  
  25. // mapblocks are used to check movement against lines and things
  26. #define MAPBLOCKUNITS    128
  27. #define    MAPBLOCKSIZE    (MAPBLOCKUNITS*FRACUNIT)
  28. #define    MAPBLOCKSHIFT    (FRACBITS+7)
  29. #define    MAPBMASK        (MAPBLOCKSIZE-1)
  30. #define    MAPBTOFRAC        (MAPBLOCKSHIFT-FRACBITS)
  31.  
  32. // player radius for movement checking
  33. #define PLAYERRADIUS 16*FRACUNIT
  34.  
  35. // MAXRADIUS is for precalculated sector block boxes
  36. // the spider demon is larger, but we don't have any moving sectors
  37. // nearby
  38. #define MAXRADIUS 32*FRACUNIT
  39.  
  40. #define    GRAVITY FRACUNIT
  41. #define    MAXMOVE (30*FRACUNIT)
  42.  
  43. #define    USERANGE (64*FRACUNIT)
  44. #define    MELEERANGE (64*FRACUNIT)
  45. #define    MISSILERANGE (32*64*FRACUNIT)
  46.  
  47. typedef enum
  48. {
  49.     DI_EAST,
  50.     DI_NORTHEAST,
  51.     DI_NORTH,
  52.     DI_NORTHWEST,
  53.     DI_WEST,
  54.     DI_SOUTHWEST,
  55.     DI_SOUTH,
  56.     DI_SOUTHEAST,
  57.     DI_NODIR,
  58.     NUMDIRS
  59. } dirtype_t;
  60.  
  61. #define BASETHRESHOLD 100 // follow a player exlusively for 3 seconds
  62.  
  63. // ***** P_TICK *****
  64.  
  65. extern thinker_t thinkercap; // both the head and tail of the thinker list
  66. extern int TimerGame; // tic countdown for deathmatch
  67.  
  68. void P_InitThinkers(void);
  69. void P_AddThinker(thinker_t *thinker);
  70. void P_RemoveThinker(thinker_t *thinker);
  71.  
  72. // ***** P_PSPR *****
  73.  
  74. #define USE_GWND_AMMO_1 1
  75. #define USE_GWND_AMMO_2 1
  76. #define USE_CBOW_AMMO_1 1
  77. #define USE_CBOW_AMMO_2 1
  78. #define USE_BLSR_AMMO_1 1
  79. #define USE_BLSR_AMMO_2 5
  80. #define USE_SKRD_AMMO_1 1
  81. #define USE_SKRD_AMMO_2 5
  82. #define USE_PHRD_AMMO_1 1
  83. #define USE_PHRD_AMMO_2 1
  84. #define USE_MACE_AMMO_1 1
  85. #define USE_MACE_AMMO_2 5
  86.  
  87. void P_OpenWeapons(void);
  88. void P_CloseWeapons(void);
  89. void P_AddMaceSpot(mapthing_t *mthing);
  90. void P_RepositionMace(mobj_t *mo);
  91. void P_SetPsprite(player_t *player, int position, statenum_t stnum);
  92. void P_SetupPsprites(player_t *curplayer);
  93. void P_MovePsprites(player_t *curplayer);
  94. void P_DropWeapon(player_t *player);
  95. void P_ActivateBeak(player_t *player);
  96. void P_PostChickenWeapon(player_t *player, weapontype_t weapon);
  97. void P_UpdateBeak(player_t *player, pspdef_t *psp);
  98.  
  99. // ***** P_USER *****
  100.  
  101. void P_PlayerThink(player_t *player);
  102. void P_Thrust(player_t *player, angle_t angle, fixed_t move);
  103. void P_PlayerRemoveArtifact(player_t *player, int slot);
  104. void P_PlayerUseArtifact(player_t *player, artitype_t arti);
  105. boolean P_UseArtifact(player_t *player, artitype_t arti);
  106. int P_GetPlayerNum(player_t *player);
  107.  
  108. // ***** P_MOBJ *****
  109.  
  110. #define FLOOR_SOLID 0
  111. #define FLOOR_WATER 1
  112. #define FLOOR_LAVA 2
  113. #define FLOOR_SLUDGE 3
  114.  
  115. #define ONFLOORZ MININT
  116. #define ONCEILINGZ MAXINT
  117. #define FLOATRANDZ (MAXINT-1)
  118.  
  119. extern mobjtype_t PuffType;
  120. extern mobj_t *MissileMobj;
  121.  
  122. mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type);
  123. void P_RemoveMobj(mobj_t *th);
  124. boolean    P_SetMobjState(mobj_t *mobj, statenum_t state);
  125. boolean    P_SetMobjStateNF(mobj_t *mobj, statenum_t state);
  126. void P_ThrustMobj(mobj_t *mo, angle_t angle, fixed_t move);
  127. int P_FaceMobj(mobj_t *source, mobj_t *target, angle_t *delta);
  128. boolean P_SeekerMissile(mobj_t *actor, angle_t thresh, angle_t turnMax);
  129. void P_MobjThinker(mobj_t *mobj);
  130. void P_BlasterMobjThinker(mobj_t *mobj);
  131. void P_SpawnPuff(fixed_t x, fixed_t y, fixed_t z);
  132. void P_SpawnBlood(fixed_t x, fixed_t y, fixed_t z, int damage);
  133. void P_BloodSplatter(fixed_t x, fixed_t y, fixed_t z, mobj_t *originator);
  134. void P_RipperBlood(mobj_t *mo);
  135. int P_GetThingFloorType(mobj_t *thing);
  136. int P_HitFloor(mobj_t *thing);
  137. boolean P_CheckMissileSpawn(mobj_t *missile);
  138. mobj_t *P_SpawnMissile(mobj_t *source, mobj_t *dest, mobjtype_t type);
  139. mobj_t *P_SpawnMissileAngle(mobj_t *source, mobjtype_t type,
  140.     angle_t angle, fixed_t momz);
  141. mobj_t *P_SpawnPlayerMissile(mobj_t *source, mobjtype_t type);
  142. mobj_t *P_SPMAngle(mobj_t *source, mobjtype_t type, angle_t angle);
  143.  
  144. // ***** P_ENEMY *****
  145.  
  146. void P_NoiseAlert (mobj_t *target, mobj_t *emmiter);
  147. void P_InitMonsters(void);
  148. void P_AddBossSpot(fixed_t x, fixed_t y, angle_t angle);
  149. void P_Massacre(void);
  150. void P_DSparilTeleport(mobj_t *actor);
  151.  
  152. // ***** P_MAPUTL *****
  153.  
  154. typedef struct
  155. {
  156.     fixed_t x, y, dx, dy;
  157. } divline_t;
  158.  
  159. typedef struct
  160. {
  161.     fixed_t        frac;        // along trace line
  162.     boolean        isaline;
  163.     union {
  164.         mobj_t    *thing;
  165.         line_t    *line;
  166.     }            d;
  167. } intercept_t;
  168.  
  169. #define    MAXINTERCEPTS    128
  170. extern    intercept_t        intercepts[MAXINTERCEPTS], *intercept_p;
  171. typedef boolean (*traverser_t) (intercept_t *in);
  172.  
  173.  
  174. fixed_t P_AproxDistance (fixed_t dx, fixed_t dy);
  175. int     P_PointOnLineSide (fixed_t x, fixed_t y, line_t *line);
  176. int     P_PointOnDivlineSide (fixed_t x, fixed_t y, divline_t *line);
  177. void     P_MakeDivline (line_t *li, divline_t *dl);
  178. fixed_t P_InterceptVector (divline_t *v2, divline_t *v1);
  179. int     P_BoxOnLineSide (fixed_t *tmbox, line_t *ld);
  180.  
  181. extern    fixed_t opentop, openbottom, openrange;
  182. extern    fixed_t    lowfloor;
  183. void     P_LineOpening (line_t *linedef);
  184.  
  185. boolean P_BlockLinesIterator (int x, int y, boolean(*func)(line_t*) );
  186. boolean P_BlockThingsIterator (int x, int y, boolean(*func)(mobj_t*) );
  187.  
  188. #define PT_ADDLINES        1
  189. #define    PT_ADDTHINGS    2
  190. #define    PT_EARLYOUT        4
  191.  
  192. extern    divline_t     trace;
  193. boolean P_PathTraverse (fixed_t x1, fixed_t y1, fixed_t x2, fixed_t y2,
  194.     int flags, boolean (*trav) (intercept_t *));
  195.  
  196. void     P_UnsetThingPosition (mobj_t *thing);
  197. void    P_SetThingPosition (mobj_t *thing);
  198.  
  199. // ***** P_MAP *****
  200.  
  201. extern boolean floatok;                // if true, move would be ok if
  202. extern fixed_t tmfloorz, tmceilingz;    // within tmfloorz - tmceilingz
  203.  
  204. extern line_t *ceilingline;
  205. boolean P_TestMobjLocation(mobj_t *mobj);
  206. boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y);
  207. mobj_t *P_CheckOnmobj(mobj_t *thing);
  208. void P_FakeZMovement(mobj_t *mo);
  209. boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y);
  210. boolean P_TeleportMove(mobj_t *thing, fixed_t x, fixed_t y);
  211. void P_SlideMove(mobj_t *mo);
  212. boolean P_CheckSight(mobj_t *t1, mobj_t *t2);
  213. void P_UseLines(player_t *player);
  214.  
  215. boolean P_ChangeSector (sector_t *sector, boolean crunch);
  216.  
  217. extern    mobj_t        *linetarget;            // who got hit (or NULL)
  218. fixed_t P_AimLineAttack (mobj_t *t1, angle_t angle, fixed_t distance);
  219.  
  220. void P_LineAttack (mobj_t *t1, angle_t angle, fixed_t distance, fixed_t slope, int damage);
  221.  
  222. void P_RadiusAttack (mobj_t *spot, mobj_t *source, int damage);
  223.  
  224. // ***** P_SETUP *****
  225.  
  226. extern byte *rejectmatrix;                // for fast sight rejection
  227. extern short *blockmaplump;                // offsets in blockmap are from here
  228. extern short *blockmap;
  229. extern int bmapwidth, bmapheight;        // in mapblocks
  230. extern fixed_t bmaporgx, bmaporgy;        // origin of block map
  231. extern mobj_t **blocklinks;                // for thing chains
  232.  
  233. // ***** P_INTER *****
  234.  
  235. extern int maxammo[NUMAMMO];
  236. extern int clipammo[NUMAMMO];
  237.  
  238. void P_SetMessage(player_t *player, char *message, boolean ultmsg);
  239. void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher);
  240. void P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source,
  241.     int damage);
  242. boolean P_GiveAmmo(player_t *player, ammotype_t ammo, int count);
  243. boolean P_GiveArtifact(player_t *player, artitype_t arti, mobj_t *mo);
  244. boolean P_GiveBody(player_t *player, int num);
  245. boolean P_GivePower(player_t *player, powertype_t power);
  246. boolean P_ChickenMorphPlayer(player_t *player);
  247.  
  248. // ***** AM_MAP *****
  249.  
  250. boolean AM_Responder(event_t *ev);
  251. void AM_Ticker(void);
  252. void AM_Drawer(void);
  253.  
  254. // ***** SB_BAR *****
  255.  
  256. extern int SB_state;
  257. extern int ArtifactFlash;
  258. void SB_PaletteFlash(void);
  259.  
  260. #include "P_spec.h"
  261.  
  262. #endif // __P_LOCAL__
  263.